package com.gugee.tiktok.common.model.es;

import com.gugee.tiktok.common.model.mysql.Aweme;
import com.gugee.tiktok.common.model.mysql.Hashtag;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ESAweme {
    private long id;
    private long awemeId;
    private String title;
    private long createTime;
    private long uid;
    private int musicId;
    private int commentCount;
    private long diggCount;
    private int downloadCount;
    private long playCount;
    private int shareCount;
    private int rate;
    private List<Keyword> awemeTags;
    private String shareUrl;
    private int duration;
    private String region;
    private boolean isAds;
    private String cover;
    private String dynamicCover;
    private Double score;
    private String awemeType;
    private String bloggerType;
    private long updateTime;
    private String uniqueId;


    @Mapper(componentModel = "spring")
    public interface ESAwemeMapper {
        @Mapping(source = "id", target = "id")
        @Mapping(source = "OAwemeId", target = "awemeId")
        @Mapping(source = "ODesc", target = "title")
        @Mapping(source = "OCreateTime", target = "createTime")
        @Mapping(source = "OUid", target = "uid")
        @Mapping(source = "OMusicId", target = "musicId")
        @Mapping(source = "OCommentCount", target = "commentCount")
        @Mapping(source = "ODiggCount", target = "diggCount")
        @Mapping(source = "ODownloadCount", target = "downloadCount")
        @Mapping(source = "OPlayCount", target = "playCount")
        @Mapping(source = "OShareCount", target = "shareCount")
        @Mapping(source = "ORate", target = "rate")
        @Mapping(source = "OShareUrl", target = "shareUrl")
        @Mapping(source = "ODuration", target = "duration")
        @Mapping(source = "ORegion", target = "region")
        @Mapping(source = "OIsAds", target = "isAds")
        @Mapping(source = "OCover", target = "cover")
        @Mapping(source = "ODynamicCover", target = "dynamicCover")
        @Mapping(source = "score", target = "score")
//        @Mapping(source = "bloggerType", target = "awemeType")
        ESAweme mapper(Aweme dto);
    }
}
